import Taro, { Component, Config } from '@tarojs/taro'
import { Image, ScrollView, Text, View } from '@tarojs/components'
import classNames from 'classnames'
import { AtIcon } from 'taro-ui'
import './index.scss'
import Top from "@/assets/images/top.png"
import { FyImg } from '@/components/index'

export default class ScrollTop extends Component {
    props: any
    state: any
    constructor() {
        super(...arguments)
        this.state = {
            showDuihuan: this.props.duihuanbi,
        }
    }

    toPageTop() {
        Taro.pageScrollTo({
            duration: 300,
            scrollTop: 0,
        })
    }

    showDuihuanbi() {
        this.props.showDuihuanbi();
    }


    render() {
        const { zhiding, duihuanbi } = this.props;

        return (
            <View>
                <View className={duihuanbi ? "notice-animation" : "notice-animation-two"} >
                    <View onClick={this.showDuihuanbi.bind(this)} className={duihuanbi ? "animate__infinite animate__animated expire" : "animate__infinite expire"}>
                        <Text className="point-name" >兑换币</Text>
                        <Text className="expire-text" >即将过期</Text>
                    </View>
                </View>
                {zhiding && <View className="totop" onClick={this.toPageTop.bind(this)}>
                   <FyImg src={Top} className="totopimg" />
                </View>}
            </View>
        )
    }
}